#include <iostream>
#include <curl/curl.h>
#include <nlohmann/json.hpp>
#include <stdlib.h>
#include <regex>
#include <string>
#include <cstring>
#include <unistd.h>
#include <typeinfo>
#include <sstream>
#include <chrono>
// #include "filestream.cpp"

using namespace std;
using json=nlohmann::json;


string millisecondsd()
{
    auto now        = std::chrono::system_clock::now();
    auto now_ms     = std::chrono::time_point_cast<std::chrono::milliseconds>(now);
    auto value      = now_ms.time_since_epoch().count();
    int mill3 		= 999-(stoi((to_string(value)).substr(10,-1)));

  	string str_time =to_string(mill3);
  	if (str_time.length()==1) str_time="00"+str_time;
  	else if (str_time.length()==2) str_time="0"+str_time;
  	else if (str_time.length()==0) str_time="000";
    return str_time;
}

//毫秒针
string mill()
{
    string ms;
    json js;
    // const char* path="milliseconds.json";
   
	ms              =millisecondsd();
	js["ms"]        =ms;
    // js["status"]    =1;
	string tms      =js.dump();
	// string sql      ="UPDATE stime SET ctime='"+tms+"' where id=2;";
	// sqlite3_idu(sql);   
    // file_put_contents(path,tms);
    // sleep(0.1);
   	return tms;
}

